home *** CD-ROM | disk | FTP | other *** search
- /*
- * the class COMPONENT_ELEMENT
- * Copyright (C) 1996, 1997 Kazutaka Hirata <khirata@jove.acs.unt.edu>
- */
-
- #include "../finfo.h"
- #include "../kbandef.h"
-
- #include "compelem.h"
-
- void COMPONENT_ELEMENT::shift(const XY& ac_dif, COMPONENT_ELEMENT& target) const
- {
- target = *this;
- target.set_ac(target.ac() + ac_dif);
- }
-
- bool COMPONENT_ELEMENT::is_in_block(const XY& ac1, const XY& ac2) const
- {
- XY ac_max = get_max();
- XY ac_min = get_min();
- XY ac_p1(ac_max.x(), ac_max.y());
- XY ac_p2(ac_max.x(), ac_min.y());
- XY ac_p3(ac_min.x(), ac_max.y());
- XY ac_p4(ac_min.x(), ac_min.y());
- bool rv1 = ac_p1.is_in_box(ac1, ac2);
- bool rv2 = ac_p2.is_in_box(ac1, ac2);
- bool rv3 = ac_p3.is_in_box(ac1, ac2);
- bool rv4 = ac_p4.is_in_box(ac1, ac2);
- return (rv1 || rv2 || rv3 || rv4);
- }
-
- int COMPONENT_ELEMENT::load_170(FILE_NEW& fp)
- {
- char str[1024];
- fp.gets_wo_return(str, 1024);
- XYT x, y;
- sscanf(str, "%d %d", &x, &y);
- x = x * 25400 / 300;
- y = y * 25400 / 300;
- set_ac(XY(x, Y_V1TOV2 - y));
- fp.gets_wo_return(m_component_name, 1024);
- fp.gets_wo_return(m_designator , 1024);
- load_component_170(fp);
- return true;
- }
-